 <!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes" />
    <meta name="format-detection" content="telephone=no" />
    <title>地图查询</title>
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main.css?v=1.0"/>
    <script type="text/javascript"
            src="http://webapi.amap.com/maps?v=1.3&key=20a0633e48c904378788437a3f5a5b37"></script>

</head>
<body style="overflow:hidden;width: 100%;height: 100%;">
<div id="mapContainer">

</div>
<script type="text/javascript">
    var myAddress = null;
    function loadMap(address){
        if(myAddress!=null && myAddress == address){
            return;
        }
        myAddress = address;
        isLoad = true;
        var map = new AMap.Map("mapContainer", {
          resizeEnable: true
         });
         var adressArr = address.split("#_#");
        var option = {
            pageIndex: 1,
                map: map,
                zoom:11
        };
        var addressName = address;
        if(adressArr.length == 3) {
            option.city = adressArr[2];
            addressName =  adressArr[0];
           AMap.service(["AMap.PlaceSearch"], function() {
              var placeSearch = new AMap.PlaceSearch(option);
              // var cpoint = [113.944173,22.538667]; //中心点坐标
              var cpointArr = adressArr[1].split(",");
              var cpoint = [cpointArr[1], cpointArr[0]];
              placeSearch.searchNearBy(addressName, cpoint, 200);
              // placeSearch.search(addressName);
           });
        }
        else {
           AMap.service(["AMap.PlaceSearch"], function() {
              var placeSearch = new AMap.PlaceSearch(option);
              placeSearch.search(addressName);
           });
        }
    }

</script>
 <script type="text/javascript" src="http://webapi.amap.com/demos/js/liteToolbar.js"></script>
</body>
</html>
